﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T15OOP2
{
    class Book:Product
    {
        private string isbn;//书号
        private string intro;//简介

 public string Isbn
        { get { return isbn; }
            set {
                //异常情况处理：抛出异常
                if(value.Length!=13)
                {
                    throw new ArgumentException("请输入13位的ISBN号");
                }
                isbn = value;
            }
        }
        public string Intro { get => intro; set => intro = value; }

        //base表示调用基类指定构造方法（显式调用）
        public Book():base("无名书籍")
        {
            Debug.WriteLine("-=调用Book默认构造方法=-");
        }
        public override void ShowDetail()
        {
            Console.WriteLine("ISBN:{0}",isbn);
            Console.WriteLine("简介:{0}", intro);
        }
        public override void Show()
        {
            base.Show();//显示调用基类被覆盖的方法
            Console.WriteLine("书籍名称：{0}",name);
            Console.WriteLine("书籍价格：{0}",price);
        }

        ~Book()
        {
            Debug.WriteLine("-=调用Book析构方法=-");
        }

       
    }
}
